#include <iostream>
#include <Eigen/Dense>
#include "cpuTracer.h"
#include <glog/logging.h>
#include "GLrender.h"
#include <time.h>
#include "cpuTracer.h"

using Eigen::MatrixXd;
using namespace std;

using namespace google;

int main(int argc, char ** argv) {
    InitGoogleLogging(argv[0]);
    google::LogToStderr();
    google::SetStderrLogging(0);
    LOG(INFO) << "start";

    Ray ray(Point(0,0,0), Point(1,0,0));
    Sphere s(Point(10,0,0), 2);

    LOG(INFO) << s.firstIntersection(ray) << endl;
    LOG(INFO) << Eigen::Vector3f(1,2,3);
    assert(anyOf<int>( (vector<int>)VectorCreator<int>(10)(20)(30),
        [](int a)->bool{ return a > 20; }));
    assert(!anyOf<int>( (vector<int>)VectorCreator<int>(10)(20)(30),
        [](int a)->bool{ return a > 30; }));
    // assert(!anyOf<int>(VectorCreator<int>(10)(20)(30),
    //     [](int a){ return a > 30; }));
    IntersectObject insObj;
    insObj.addObject(new Sphere(Point(0,0,0), 0.5));
    insObj.addObject(new Sphere(Point(0,0.3,0), 0.5));
    GLrender render;
    render.initOpenGL();
    // render.addObject(new Sphere(Point(0,0,0), 0.5));
    // render.addObject(new Sphere(Point(0,0.2,0), 0.5));
    render.addObject(&insObj);
    render.mainLoop();
}